<?php
class AcaoControle
{
	private $objConexaoControle;
	private $arrParametros;
	private $strAcao;

	function __construct($objConexaoControle, $arrParametros)
	{
		$this->objConexaoControle = $objConexaoControle;
		$this->arrParametros = $arrParametros;
		$this->controlador();
	}
	
	private function controlador()
	{
		if (isset($this->arrParametros['ACAO']) === true && trim($this->arrParametros['ACAO']) != "") {
			$this->strAcao = trim($this->arrParametros['ACAO']);
			$this->inicializaAcao()
		}
	}
	
	private function inicializaAcao()
	{
		if ($this->ehIncluivel() === false) {
			$this->criaNovaAcao();
		}
		include $this->strAcao."php";
		$objAcao = new $this->strAcao($this->objConexaoControle, $this->arrParametros);
		$objAcao->inserir();
	}
	
	private function ehIncluivel()
	{
		if (is_file($this->strAcao) && is_readable($this->strAcao)) {
			return true;
		}
	}
	
	private function criaNovaAcao()
	{
		$this->strAcao;
	}
	
	
	
	
	function register($className, $classPath, $methodName, $args)
	{
		if(!file_exists($classPath)) return false;

		require_once($classPath);

		if(!class_exists($className)) return false;

		$classInstance = new $className;

		if(!method_exists($classInstance, $methodName)) return false;

		$classInstance->$methodName($args);
	}
}
?>